
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (int)(b); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int N = 110;
ll a[N][N], b[N][N], c[N][N];
int n;
int main() {
  cin >> n;
  rep(i, 0, n) rep(j, 0, n) cin >> a[i][j];
  rep(i, 0, n) rep(j, 0, n) cin >> b[i][j];
  rep(i, 0, n) rep(j, 0, n) rep(k, 0, n) c[i][j] += a[i][k] * b[k][j];
  rep(i, 0, n) {
    rep(j, 0, n) cout << c[i][j] << ' ';
    cout << '\n';
  }
  return 0;
}
